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

class B:
    def __init__(self, txt: str):
        self.s: B = None
        self.x: A = None
        self.t: 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.o: B = None
        self.p: C = None
        self.y: A = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.s: B = None
        self.x: A = None
        self.t: 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.o: B = None
        self.p: C = None
        self.y: A = None
        self.txt = txt

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

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