class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: F = None
        self.t: F = 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.y: E = None
        self.v: A = None
        self.q: B = None
        self.u: F = None
        self.r: G = None
        self.s: D = None
        self.w: E = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.u: C = None
        self.o: E = None
        self.txt = txt

k = A("k")
m = B("m")
f = C("f")
d = D("d")
c = E("c")
j = F("j")
l = G("l")

k.p = m
k.u = j
k.t = j
m.y = d
f.y = c
f.w = c
f.v = k
f.q = m
f.u = j
f.r = l
f.s = d
d.s = j
d.p = j
d.y = k
d.t = f
c.w = l
j.y = f
j.u = m
j.p = l
l.u = f
l.o = c
assert k.t.p.u.q.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: F = None
        self.t: F = 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.y: E = None
        self.v: A = None
        self.q: B = None
        self.u: F = None
        self.r: G = None
        self.s: D = None
        self.w: E = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.u: C = None
        self.o: E = None
        self.txt = txt

k = A("k")
m = B("m")
f = C("f")
d = D("d")
c = E("c")
j = F("j")
l = G("l")

k.p = m
k.u = j
k.t = j
m.y = d
f.y = c
f.w = c
f.v = k
f.q = m
f.u = j
f.r = l
f.s = d
d.s = j
d.p = j
d.y = k
d.t = f
c.w = l
j.y = f
j.u = m
j.p = l
l.u = f
l.o = c
assert k.t.p.u.q.y.t.txt == "f"