class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.o: D = None
        self.v: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.z: E = None
        self.q: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.p: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: D = None
        self.txt = txt

j = A("j")
f = B("f")
c = C("c")
k = D("k")
n = E("n")
e = B("e")
a = A("a")
h = D("h")

j.r = k
j.o = k
j.v = n
f.o = c
f.x = c
c.o = n
c.z = n
c.q = h
k.t = n
k.p = f
n.y = e
n.t = k
e.o = c
e.x = c
a.r = h
a.o = h
a.v = n
h.t = n
h.p = e
assert c.z.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.o: D = None
        self.v: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.z: E = None
        self.q: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.p: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: D = None
        self.txt = txt

j = A("j")
f = B("f")
c = C("c")
k = D("k")
n = E("n")
e = B("e")
a = A("a")
h = D("h")

j.r = k
j.o = k
j.v = n
f.o = c
f.x = c
c.o = n
c.z = n
c.q = h
k.t = n
k.p = f
n.y = e
n.t = k
e.o = c
e.x = c
a.r = h
a.o = h
a.v = n
h.t = n
h.p = e
assert c.z.y.x.txt == "c"