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

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.t: F = None
        self.z: D = None
        self.y: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: E = None
        self.r: F = None
        self.txt = txt

d = A("d")
n = B("n")
j = C("j")
h = D("h")
l = E("l")
b = F("b")
m = E("m")
e = F("e")

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

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.t: F = None
        self.z: D = None
        self.y: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: E = None
        self.r: F = None
        self.txt = txt

d = A("d")
n = B("n")
j = C("j")
h = D("h")
l = E("l")
b = F("b")
m = E("m")
e = F("e")

d.x = b
n.p = d
n.t = e
n.z = h
n.y = h
j.u = b
j.o = h
j.y = n
h.p = l
h.t = b
h.u = n
l.w = n
b.y = l
b.r = e
m.w = n
e.y = l
e.r = b
assert j.y.z.u.txt == "n"