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

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

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

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

j = A("j")
f = B("f")
b = C("b")
d = D("d")
c = B("c")
m = C("m")
n = D("n")

j.y = d
j.o = d
j.p = d
f.y = b
f.x = b
f.t = d
b.u = f
b.p = m
b.o = m
d.v = j
d.x = c
d.s = c
c.y = b
c.t = d
c.x = m
m.u = c
m.p = b
m.o = b
n.v = j
n.x = f
n.s = c
assert f.t.v.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.o: D = None
        self.p: D = None
        self.txt = txt

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

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

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

j = A("j")
f = B("f")
b = C("b")
d = D("d")
c = B("c")
m = C("m")
n = D("n")

j.y = d
j.o = d
j.p = d
f.y = b
f.x = b
f.t = d
b.u = f
b.p = m
b.o = m
d.v = j
d.x = c
d.s = c
c.y = b
c.t = d
c.x = m
m.u = c
m.p = b
m.o = b
n.v = j
n.x = f
n.s = c
assert f.t.v.y.v.txt == "j"