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

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

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

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

i = A("i")
n = B("n")
j = C("j")
m = D("m")
l = A("l")
b = C("b")

i.r = j
i.o = m
i.p = b
n.x = b
n.q = b
j.v = l
j.u = b
j.s = i
j.o = n
m.v = b
l.r = j
l.p = j
l.o = m
b.v = l
b.s = l
b.u = j
b.o = n
assert i.p.v.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: D = None
        self.p: C = None
        self.txt = txt

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

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

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

i = A("i")
n = B("n")
j = C("j")
m = D("m")
l = A("l")
b = C("b")

i.r = j
i.o = m
i.p = b
n.x = b
n.q = b
j.v = l
j.u = b
j.s = i
j.o = n
m.v = b
l.r = j
l.p = j
l.o = m
b.v = l
b.s = l
b.u = j
b.o = n
assert i.p.v.o.v.txt == "b"