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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.r: B = None
        self.w: C = None
        self.q: B = None
        self.txt = txt

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

b = A("b")
e = B("e")
j = C("j")
n = D("n")
f = E("f")
a = F("a")
h = E("h")

b.x = j
e.r = n
j.u = e
j.z = a
j.t = b
n.p = a
f.x = a
f.r = e
f.q = e
f.w = j
a.v = n
a.p = e
a.w = e
a.x = e
h.x = a
h.r = e
h.q = e
h.w = j
assert e.r.p.v.p.p.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.r: B = None
        self.w: C = None
        self.q: B = None
        self.txt = txt

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

b = A("b")
e = B("e")
j = C("j")
n = D("n")
f = E("f")
a = F("a")
h = E("h")

b.x = j
e.r = n
j.u = e
j.z = a
j.t = b
n.p = a
f.x = a
f.r = e
f.q = e
f.w = j
a.v = n
a.p = e
a.w = e
a.x = e
h.x = a
h.r = e
h.q = e
h.w = j
assert e.r.p.v.p.p.r.p.txt == "a"