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

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

class C:
    def __init__(self, txt: str):
        self.u: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: E = None
        self.p: D = None
        self.z: D = None
        self.s: B = None
        self.r: E = None
        self.txt = txt

f = A("f")
j = B("j")
n = C("n")
a = D("a")
d = E("d")
g = F("g")
c = B("c")
m = B("m")
h = E("h")

f.r = m
f.z = d
f.u = d
f.x = j
f.v = a
j.y = a
n.u = g
a.v = c
a.r = n
a.w = n
a.x = n
d.z = h
g.y = d
g.r = d
g.p = a
g.z = a
g.s = m
c.y = a
m.y = a
h.z = d
assert j.y.v.y.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.z: E = None
        self.u: E = None
        self.x: B = None
        self.v: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: E = None
        self.p: D = None
        self.z: D = None
        self.s: B = None
        self.r: E = None
        self.txt = txt

f = A("f")
j = B("j")
n = C("n")
a = D("a")
d = E("d")
g = F("g")
c = B("c")
m = B("m")
h = E("h")

f.r = m
f.z = d
f.u = d
f.x = j
f.v = a
j.y = a
n.u = g
a.v = c
a.r = n
a.w = n
a.x = n
d.z = h
g.y = d
g.r = d
g.p = a
g.z = a
g.s = m
c.y = a
m.y = a
h.z = d
assert j.y.v.y.v.y.txt == "a"