class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.z: C = None
        self.y: F = None
        self.q: D = None
        self.txt = txt

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

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

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

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

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

i = A("i")
b = B("b")
n = C("n")
g = D("g")
d = E("d")
f = F("f")
j = C("j")
k = B("k")
l = D("l")

i.u = g
i.q = g
i.z = j
i.y = f
b.t = j
n.t = f
n.p = f
n.y = g
n.z = i
g.s = d
d.o = f
f.s = n
j.t = f
j.p = f
j.y = l
j.z = i
k.t = n
l.s = d
assert f.s.t.s.z.z.y.s.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.z: C = None
        self.y: F = None
        self.q: D = None
        self.txt = txt

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

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

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

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

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

i = A("i")
b = B("b")
n = C("n")
g = D("g")
d = E("d")
f = F("f")
j = C("j")
k = B("k")
l = D("l")

i.u = g
i.q = g
i.z = j
i.y = f
b.t = j
n.t = f
n.p = f
n.y = g
n.z = i
g.s = d
d.o = f
f.s = n
j.t = f
j.p = f
j.y = l
j.z = i
k.t = n
l.s = d
assert f.s.t.s.z.z.y.s.o.txt == "f"