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

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

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: A = None
        self.v: C = None
        self.w: B = None
        self.txt = txt

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

a = A("a")
c = B("c")
m = C("m")
g = D("g")
b = E("b")
k = F("k")
e = A("e")

a.z = k
a.o = c
a.w = g
c.v = k
c.p = e
c.x = g
m.z = k
g.t = k
g.o = k
b.p = c
b.w = c
b.u = e
b.v = m
k.x = m
k.u = c
k.y = g
e.z = k
e.o = c
e.w = g
assert a.w.t.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.o: B = None
        self.w: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: A = None
        self.v: C = None
        self.w: B = None
        self.txt = txt

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

a = A("a")
c = B("c")
m = C("m")
g = D("g")
b = E("b")
k = F("k")
e = A("e")

a.z = k
a.o = c
a.w = g
c.v = k
c.p = e
c.x = g
m.z = k
g.t = k
g.o = k
b.p = c
b.w = c
b.u = e
b.v = m
k.x = m
k.u = c
k.y = g
e.z = k
e.o = c
e.w = g
assert a.w.t.u.p.txt == "e"