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

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: F = None
        self.v: C = None
        self.y: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.p: D = None
        self.z: B = None
        self.q: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: F = None
        self.o: F = None
        self.z: A = None
        self.u: B = None
        self.txt = txt

k = A("k")
e = B("e")
j = C("j")
d = D("d")
c = E("c")
a = F("a")
h = F("h")

k.y = e
k.s = c
e.t = j
e.v = j
e.q = h
e.y = c
j.p = c
d.x = j
c.w = d
c.p = d
c.z = e
c.q = k
a.t = h
a.o = h
a.z = k
a.u = e
h.t = a
h.o = a
h.z = k
h.u = e
assert h.u.q.o.u.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: F = None
        self.v: C = None
        self.y: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.p: D = None
        self.z: B = None
        self.q: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: F = None
        self.o: F = None
        self.z: A = None
        self.u: B = None
        self.txt = txt

k = A("k")
e = B("e")
j = C("j")
d = D("d")
c = E("c")
a = F("a")
h = F("h")

k.y = e
k.s = c
e.t = j
e.v = j
e.q = h
e.y = c
j.p = c
d.x = j
c.w = d
c.p = d
c.z = e
c.q = k
a.t = h
a.o = h
a.z = k
a.u = e
h.t = a
h.o = a
h.z = k
h.u = e
assert h.u.q.o.u.t.p.txt == "c"