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.y: C = None
        self.q: A = None
        self.txt = txt

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

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

l = A("l")
h = B("h")
m = C("m")
k = D("k")
f = C("f")
b = D("b")

l.v = f
l.o = m
h.y = f
h.q = l
m.p = k
m.w = k
m.r = l
m.o = f
k.x = l
f.p = b
f.w = b
f.r = l
f.o = m
b.x = l
assert b.x.o.r.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.y: C = None
        self.q: A = None
        self.txt = txt

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

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

l = A("l")
h = B("h")
m = C("m")
k = D("k")
f = C("f")
b = D("b")

l.v = f
l.o = m
h.y = f
h.q = l
m.p = k
m.w = k
m.r = l
m.o = f
k.x = l
f.p = b
f.w = b
f.r = l
f.o = m
b.x = l
assert b.x.o.r.txt == "l"