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

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

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: A = None
        self.o: F = None
        self.r: C = None
        self.u: A = None
        self.txt = txt

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

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

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

l.u = d
l.w = j
k.y = c
k.p = c
k.o = f
c.t = l
c.x = j
c.v = k
g.q = c
g.r = c
g.p = j
g.o = d
g.u = i
f.u = g
d.w = g
j.u = d
j.w = l
i.u = d
i.w = j
assert j.u.w.u.w.u.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.w: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: A = None
        self.o: F = None
        self.r: C = None
        self.u: A = None
        self.txt = txt

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

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

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

l.u = d
l.w = j
k.y = c
k.p = c
k.o = f
c.t = l
c.x = j
c.v = k
g.q = c
g.r = c
g.p = j
g.o = d
g.u = i
f.u = g
d.w = g
j.u = d
j.w = l
i.u = d
i.w = j
assert j.u.w.u.w.u.w.q.txt == "c"