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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.t: B = None
        self.o: F = None
        self.x: C = None
        self.r: C = None
        self.z: D = None
        self.txt = txt

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

h = A("h")
m = B("m")
c = C("c")
j = D("j")
b = E("b")
n = F("n")

h.p = b
m.w = n
m.s = n
c.p = j
j.u = c
b.y = j
b.z = j
b.t = m
b.o = n
b.x = c
b.r = c
n.x = c
n.o = b
n.y = m
assert c.p.u.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.t: B = None
        self.o: F = None
        self.x: C = None
        self.r: C = None
        self.z: D = None
        self.txt = txt

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

h = A("h")
m = B("m")
c = C("c")
j = D("j")
b = E("b")
n = F("n")

h.p = b
m.w = n
m.s = n
c.p = j
j.u = c
b.y = j
b.z = j
b.t = m
b.o = n
b.x = c
b.r = c
n.x = c
n.o = b
n.y = m
assert c.p.u.p.u.txt == "c"