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

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

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

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

c = A("c")
k = B("k")
f = C("f")
n = D("n")
g = D("g")
h = A("h")
b = C("b")
m = D("m")
d = B("d")
l = A("l")

c.q = g
c.t = g
k.p = g
k.w = d
k.u = d
k.z = l
f.p = b
f.x = b
f.v = b
f.r = b
n.q = b
n.t = m
g.q = b
g.t = m
h.q = n
h.t = g
b.p = f
b.x = f
b.v = f
b.r = f
m.q = f
m.t = g
d.p = m
d.w = k
d.u = k
d.z = c
l.q = g
l.t = n
assert f.v.r.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.t: D = None
        self.txt = txt

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

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

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

c = A("c")
k = B("k")
f = C("f")
n = D("n")
g = D("g")
h = A("h")
b = C("b")
m = D("m")
d = B("d")
l = A("l")

c.q = g
c.t = g
k.p = g
k.w = d
k.u = d
k.z = l
f.p = b
f.x = b
f.v = b
f.r = b
n.q = b
n.t = m
g.q = b
g.t = m
h.q = n
h.t = g
b.p = f
b.x = f
b.v = f
b.r = f
m.q = f
m.t = g
d.p = m
d.w = k
d.u = k
d.z = c
l.q = g
l.t = n
assert f.v.r.p.v.txt == "f"