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

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

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

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

k = A("k")
c = B("c")
d = C("d")
m = D("m")
l = B("l")
b = D("b")

k.t = l
k.v = b
c.r = d
c.o = m
c.t = k
c.p = l
d.q = k
m.v = k
l.r = d
l.o = m
l.t = k
l.p = c
b.v = k
assert k.v.v.t.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: D = None
        self.txt = txt

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

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

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

k = A("k")
c = B("c")
d = C("d")
m = D("m")
l = B("l")
b = D("b")

k.t = l
k.v = b
c.r = d
c.o = m
c.t = k
c.p = l
d.q = k
m.v = k
l.r = d
l.o = m
l.t = k
l.p = c
b.v = k
assert k.v.v.t.p.o.txt == "m"