class A:
    def __init__(self, txt: str):
        self.t: F = None
        self.x: D = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

b = A("b")
g = B("g")
l = C("l")
h = D("h")
e = E("e")
k = F("k")

b.t = k
b.x = h
g.z = k
g.p = e
g.x = e
g.w = h
l.q = k
l.v = e
h.x = e
h.o = l
h.u = b
e.p = h
k.o = e
assert b.t.o.p.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: F = None
        self.x: D = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

b = A("b")
g = B("g")
l = C("l")
h = D("h")
e = E("e")
k = F("k")

b.t = k
b.x = h
g.z = k
g.p = e
g.x = e
g.w = h
l.q = k
l.v = e
h.x = e
h.o = l
h.u = b
e.p = h
k.o = e
assert b.t.o.p.o.q.txt == "k"