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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.v: D = None
        self.r: A = None
        self.s: C = None
        self.txt = txt

k = A("k")
g = B("g")
c = C("c")
b = D("b")
l = E("l")
f = F("f")
e = G("e")

k.p = l
g.q = l
g.t = l
g.x = c
g.r = e
c.p = g
c.y = g
c.r = f
c.t = l
c.q = k
b.z = g
l.q = g
l.u = e
f.v = c
f.r = g
f.y = b
f.p = l
e.v = b
e.r = k
e.s = c
assert l.q.x.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.v: D = None
        self.r: A = None
        self.s: C = None
        self.txt = txt

k = A("k")
g = B("g")
c = C("c")
b = D("b")
l = E("l")
f = F("f")
e = G("e")

k.p = l
g.q = l
g.t = l
g.x = c
g.r = e
c.p = g
c.y = g
c.r = f
c.t = l
c.q = k
b.z = g
l.q = g
l.u = e
f.v = c
f.r = g
f.y = b
f.p = l
e.v = b
e.r = k
e.s = c
assert l.q.x.y.r.txt == "e"