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

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

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

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

d = A("d")
k = B("k")
b = C("b")
f = D("f")
e = A("e")
h = C("h")
m = B("m")
j = D("j")

d.r = b
d.v = e
k.w = f
k.z = j
k.o = d
k.u = b
b.y = e
f.v = m
f.r = e
f.t = j
f.w = b
e.r = b
e.v = d
h.y = e
m.w = j
m.z = j
m.o = e
m.u = b
j.v = k
j.r = e
j.t = f
j.w = h
assert f.r.r.y.v.r.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: A = None
        self.txt = txt

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

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

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

d = A("d")
k = B("k")
b = C("b")
f = D("f")
e = A("e")
h = C("h")
m = B("m")
j = D("j")

d.r = b
d.v = e
k.w = f
k.z = j
k.o = d
k.u = b
b.y = e
f.v = m
f.r = e
f.t = j
f.w = b
e.r = b
e.v = d
h.y = e
m.w = j
m.z = j
m.o = e
m.u = b
j.v = k
j.r = e
j.t = f
j.w = h
assert f.r.r.y.v.r.y.r.txt == "b"