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

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

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

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

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

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

m = A("m")
h = B("h")
c = C("c")
d = D("d")
k = E("k")
l = F("l")
a = E("a")

m.t = c
h.t = l
c.s = k
c.w = m
d.x = h
d.s = h
d.u = h
d.z = m
k.t = m
k.x = h
k.p = l
l.w = d
l.v = m
a.t = m
a.x = h
a.p = l
assert c.w.t.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

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

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

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

m = A("m")
h = B("h")
c = C("c")
d = D("d")
k = E("k")
l = F("l")
a = E("a")

m.t = c
h.t = l
c.s = k
c.w = m
d.x = h
d.s = h
d.u = h
d.z = m
k.t = m
k.x = h
k.p = l
l.w = d
l.v = m
a.t = m
a.x = h
a.p = l
assert c.w.t.s.p.txt == "l"