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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: D = None
        self.z: B = None
        self.t: C = None
        self.y: C = None
        self.s: A = None
        self.txt = txt

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

h = A("h")
c = B("c")
i = C("i")
e = D("e")
f = E("f")
g = F("g")

h.p = g
c.u = g
i.s = g
e.z = h
e.o = i
e.u = g
e.s = f
f.r = h
f.s = h
f.w = e
f.z = c
f.t = i
f.y = i
g.y = c
g.q = c
g.r = c
g.x = c
g.z = i
assert f.z.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: D = None
        self.z: B = None
        self.t: C = None
        self.y: C = None
        self.s: A = None
        self.txt = txt

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

h = A("h")
c = B("c")
i = C("i")
e = D("e")
f = E("f")
g = F("g")

h.p = g
c.u = g
i.s = g
e.z = h
e.o = i
e.u = g
e.s = f
f.r = h
f.s = h
f.w = e
f.z = c
f.t = i
f.y = i
g.y = c
g.q = c
g.r = c
g.x = c
g.z = i
assert f.z.u.r.txt == "c"