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

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

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

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

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

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

f = A("f")
l = B("l")
b = C("b")
a = D("a")
h = E("h")
n = F("n")
i = B("i")

f.u = i
f.r = n
f.p = l
l.t = b
l.v = b
l.r = i
l.w = i
l.q = a
b.z = h
a.w = f
a.x = f
h.y = a
h.t = n
h.s = n
h.v = b
h.x = f
n.q = b
i.t = b
i.v = b
i.r = l
i.w = l
i.q = a
assert l.q.x.p.q.x.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.r: F = None
        self.p: B = None
        self.txt = txt

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

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

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

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

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

f = A("f")
l = B("l")
b = C("b")
a = D("a")
h = E("h")
n = F("n")
i = B("i")

f.u = i
f.r = n
f.p = l
l.t = b
l.v = b
l.r = i
l.w = i
l.q = a
b.z = h
a.w = f
a.x = f
h.y = a
h.t = n
h.s = n
h.v = b
h.x = f
n.q = b
i.t = b
i.v = b
i.r = l
i.w = l
i.q = a
assert l.q.x.p.q.x.r.q.txt == "b"