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

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

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

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

g = A("g")
f = B("f")
c = C("c")
e = D("e")
j = A("j")
b = D("b")

g.v = c
g.t = c
g.p = f
f.y = e
c.u = f
c.o = e
c.y = g
c.t = b
e.q = j
j.v = c
j.t = c
j.p = f
b.q = j
assert j.v.u.y.q.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.t: C = None
        self.p: B = None
        self.txt = txt

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

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

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

g = A("g")
f = B("f")
c = C("c")
e = D("e")
j = A("j")
b = D("b")

g.v = c
g.t = c
g.p = f
f.y = e
c.u = f
c.o = e
c.y = g
c.t = b
e.q = j
j.v = c
j.t = c
j.p = f
b.q = j
assert j.v.u.y.q.v.t.txt == "b"