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

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

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

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

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

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

l = A("l")
h = B("h")
g = C("g")
f = D("f")
b = E("b")
i = F("i")
e = D("e")
d = E("d")

l.t = h
l.r = e
h.u = l
g.t = e
g.u = f
g.o = h
f.u = e
b.x = h
b.w = h
b.o = g
b.u = g
b.p = d
b.s = l
i.w = b
e.u = f
d.x = h
d.w = h
d.o = g
d.u = g
d.p = b
d.s = l
assert e.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.r: D = None
        self.txt = txt

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

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

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

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

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

l = A("l")
h = B("h")
g = C("g")
f = D("f")
b = E("b")
i = F("i")
e = D("e")
d = E("d")

l.t = h
l.r = e
h.u = l
g.t = e
g.u = f
g.o = h
f.u = e
b.x = h
b.w = h
b.o = g
b.u = g
b.p = d
b.s = l
i.w = b
e.u = f
d.x = h
d.w = h
d.o = g
d.u = g
d.p = b
d.s = l
assert e.u.u.u.txt == "f"