class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.q: E = None
        self.y: C = None
        self.v: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.q: B = None
        self.v: A = None
        self.t: E = None
        self.r: E = None
        self.y: E = None
        self.txt = txt

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

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

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

f = A("f")
b = B("b")
g = C("g")
k = D("k")
i = E("i")
l = F("l")

f.p = l
f.q = i
f.y = g
f.v = b
b.s = f
b.p = f
g.p = b
g.q = b
g.v = f
g.t = i
g.r = i
g.y = i
k.v = l
i.y = f
l.x = i
l.p = i
l.w = g
l.r = g
l.o = b
l.q = f
assert b.s.y.q.p.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.q: E = None
        self.y: C = None
        self.v: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.q: B = None
        self.v: A = None
        self.t: E = None
        self.r: E = None
        self.y: E = None
        self.txt = txt

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

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

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

f = A("f")
b = B("b")
g = C("g")
k = D("k")
i = E("i")
l = F("l")

f.p = l
f.q = i
f.y = g
f.v = b
b.s = f
b.p = f
g.p = b
g.q = b
g.v = f
g.t = i
g.r = i
g.y = i
k.v = l
i.y = f
l.x = i
l.p = i
l.w = g
l.r = g
l.o = b
l.q = f
assert b.s.y.q.p.q.y.txt == "f"