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

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

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

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

j = A("j")
e = B("e")
c = C("c")
d = D("d")
n = D("n")
f = C("f")

j.v = c
j.o = f
e.x = j
c.u = n
c.o = n
c.q = e
d.w = e
d.y = f
n.w = e
n.y = c
f.u = d
f.q = e
f.o = n
assert j.o.q.x.v.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: C = None
        self.txt = txt

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

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

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

j = A("j")
e = B("e")
c = C("c")
d = D("d")
n = D("n")
f = C("f")

j.v = c
j.o = f
e.x = j
c.u = n
c.o = n
c.q = e
d.w = e
d.y = f
n.w = e
n.y = c
f.u = d
f.q = e
f.o = n
assert j.o.q.x.v.q.x.txt == "j"