class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.u: B = None
        self.q: F = None
        self.v: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: A = None
        self.z: C = None
        self.q: B = None
        self.w: B = None
        self.x: C = None
        self.txt = txt

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

a.r = b
h.q = j
n.p = j
n.x = j
n.s = j
n.r = b
j.w = k
j.p = a
j.s = n
j.v = b
j.z = b
k.o = j
k.v = j
k.u = h
k.q = b
b.p = a
b.z = n
b.x = n
b.q = h
b.w = h
assert h.q.p.r.p.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.u: B = None
        self.q: F = None
        self.v: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: A = None
        self.z: C = None
        self.q: B = None
        self.w: B = None
        self.x: C = None
        self.txt = txt

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

a.r = b
h.q = j
n.p = j
n.x = j
n.s = j
n.r = b
j.w = k
j.p = a
j.s = n
j.v = b
j.z = b
k.o = j
k.v = j
k.u = h
k.q = b
b.p = a
b.z = n
b.x = n
b.q = h
b.w = h
assert h.q.p.r.p.r.txt == "b"