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

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

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

class D:
    def __init__(self, txt: str):
        self.q: D = None
        self.v: A = None
        self.y: A = None
        self.t: C = None
        self.txt = txt

g = A("g")
a = B("a")
e = C("e")
n = D("n")
b = C("b")
j = D("j")
i = C("i")
k = B("k")
h = B("h")

g.u = i
a.v = g
a.u = g
a.w = n
e.p = g
e.x = i
n.q = j
n.v = g
n.y = g
n.t = b
b.p = g
b.x = i
j.q = n
j.v = g
j.y = g
j.t = b
i.p = g
i.x = b
k.v = g
k.u = g
k.w = n
h.v = g
h.u = g
h.w = j
assert e.x.x.x.x.x.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: D = None
        self.v: A = None
        self.y: A = None
        self.t: C = None
        self.txt = txt

g = A("g")
a = B("a")
e = C("e")
n = D("n")
b = C("b")
j = D("j")
i = C("i")
k = B("k")
h = B("h")

g.u = i
a.v = g
a.u = g
a.w = n
e.p = g
e.x = i
n.q = j
n.v = g
n.y = g
n.t = b
b.p = g
b.x = i
j.q = n
j.v = g
j.y = g
j.t = b
i.p = g
i.x = b
k.v = g
k.u = g
k.w = n
h.v = g
h.u = g
h.w = j
assert e.x.x.x.x.x.x.x.x.x.txt == "i"