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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.s: F = None
        self.v: A = None
        self.txt = txt

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

i.u = l
i.y = l
l.q = g
l.y = d
h.y = l
c.x = d
j.q = k
j.w = h
j.u = n
n.y = i
n.v = i
n.s = g
g.y = i
g.v = i
g.s = n
k.q = j
k.w = h
k.u = g
d.x = c
assert d.x.x.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.y: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.s: F = None
        self.v: A = None
        self.txt = txt

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

i.u = l
i.y = l
l.q = g
l.y = d
h.y = l
c.x = d
j.q = k
j.w = h
j.u = n
n.y = i
n.v = i
n.s = g
g.y = i
g.v = i
g.s = n
k.q = j
k.w = h
k.u = g
d.x = c
assert d.x.x.x.x.x.x.txt == "d"