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

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: D = None
        self.w: B = None
        self.r: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.t: C = None
        self.u: F = None
        self.y: A = None
        self.p: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.s: D = None
        self.z: B = None
        self.p: C = None
        self.txt = txt

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

d = A("d")
a = B("a")
c = C("c")
h = D("h")
j = E("j")
i = F("i")
k = D("k")

d.p = c
d.s = h
a.v = i
a.w = k
c.z = a
c.w = a
c.s = h
c.r = i
h.s = c
h.t = c
h.p = c
h.u = i
h.y = d
j.t = d
j.s = k
j.z = a
j.p = c
i.v = k
k.s = c
k.t = c
k.p = c
k.u = i
k.y = d
assert c.r.v.y.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: D = None
        self.w: B = None
        self.r: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.t: C = None
        self.u: F = None
        self.y: A = None
        self.p: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.s: D = None
        self.z: B = None
        self.p: C = None
        self.txt = txt

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

d = A("d")
a = B("a")
c = C("c")
h = D("h")
j = E("j")
i = F("i")
k = D("k")

d.p = c
d.s = h
a.v = i
a.w = k
c.z = a
c.w = a
c.s = h
c.r = i
h.s = c
h.t = c
h.p = c
h.u = i
h.y = d
j.t = d
j.s = k
j.z = a
j.p = c
i.v = k
k.s = c
k.t = c
k.p = c
k.u = i
k.y = d
assert c.r.v.y.s.u.txt == "i"