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

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

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

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

f = A("f")
j = B("j")
n = C("n")
k = D("k")
i = C("i")
b = A("b")
d = D("d")

f.t = j
f.o = j
f.p = k
f.r = k
j.v = f
j.o = k
n.y = j
n.o = f
n.r = d
k.o = i
i.y = j
i.o = b
i.r = k
b.t = j
b.o = j
b.p = k
b.r = k
d.o = i
assert n.y.v.r.o.o.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: B = None
        self.p: D = None
        self.r: D = None
        self.txt = txt

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

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

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

f = A("f")
j = B("j")
n = C("n")
k = D("k")
i = C("i")
b = A("b")
d = D("d")

f.t = j
f.o = j
f.p = k
f.r = k
j.v = f
j.o = k
n.y = j
n.o = f
n.r = d
k.o = i
i.y = j
i.o = b
i.r = k
b.t = j
b.o = j
b.p = k
b.r = k
d.o = i
assert n.y.v.r.o.o.o.v.txt == "f"