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

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: A = None
        self.u: D = None
        self.s: F = None
        self.txt = txt

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

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

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

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

m = A("m")
n = B("n")
d = C("d")
h = D("h")
g = E("g")
e = F("e")

m.t = h
n.w = g
n.x = m
n.u = h
n.s = e
d.o = g
d.u = h
d.p = n
h.y = d
g.q = m
g.v = m
g.t = d
e.z = d
e.p = n
e.v = h
assert m.t.y.u.y.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: A = None
        self.u: D = None
        self.s: F = None
        self.txt = txt

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

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

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

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

m = A("m")
n = B("n")
d = C("d")
h = D("h")
g = E("g")
e = F("e")

m.t = h
n.w = g
n.x = m
n.u = h
n.s = e
d.o = g
d.u = h
d.p = n
h.y = d
g.q = m
g.v = m
g.t = d
e.z = d
e.p = n
e.v = h
assert m.t.y.u.y.p.s.txt == "e"