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

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

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

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

a = A("a")
k = B("k")
g = C("g")
j = D("j")
d = D("d")
n = B("n")

a.q = j
k.o = d
g.w = j
g.y = j
j.u = n
j.v = d
j.z = a
j.p = a
d.u = n
d.v = j
d.z = a
d.p = a
n.o = d
assert k.o.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

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

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

a = A("a")
k = B("k")
g = C("g")
j = D("j")
d = D("d")
n = B("n")

a.q = j
k.o = d
g.w = j
g.y = j
j.u = n
j.v = d
j.z = a
j.p = a
d.u = n
d.v = j
d.z = a
d.p = a
n.o = d
assert k.o.v.v.v.txt == "j"