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

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

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

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

g = A("g")
k = B("k")
l = C("l")
j = D("j")
c = D("c")
b = A("b")
e = D("e")
h = A("h")

g.u = l
g.p = b
g.x = h
k.y = c
k.o = l
k.v = e
l.o = k
l.z = k
j.x = c
j.z = l
c.x = j
c.z = l
b.u = l
b.p = h
b.x = g
e.x = c
e.z = l
h.u = l
h.p = g
h.x = g
assert j.z.o.v.x.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.p: A = None
        self.x: A = None
        self.txt = txt

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

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

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

g = A("g")
k = B("k")
l = C("l")
j = D("j")
c = D("c")
b = A("b")
e = D("e")
h = A("h")

g.u = l
g.p = b
g.x = h
k.y = c
k.o = l
k.v = e
l.o = k
l.z = k
j.x = c
j.z = l
c.x = j
c.z = l
b.u = l
b.p = h
b.x = g
e.x = c
e.z = l
h.u = l
h.p = g
h.x = g
assert j.z.o.v.x.x.x.x.x.txt == "c"