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

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

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

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

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

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

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

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

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

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

b.v = c
k.y = f
k.v = f
k.x = a
k.u = b
f.x = j
f.w = c
f.s = k
c.p = b
j.v = c
a.y = f
a.v = f
a.x = k
a.u = b
assert c.p.v.p.v.p.txt == "b"