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

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

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

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

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

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

m = A("m")
c = B("c")
g = C("g")
n = D("n")
l = E("l")
j = F("j")

m.p = l
m.v = j
m.s = c
c.v = l
c.r = j
c.o = n
c.t = n
g.x = l
g.p = n
g.s = j
n.v = j
n.q = m
l.p = n
j.q = n
j.y = n
j.v = l
j.x = l
j.t = c
assert m.v.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.v: F = None
        self.s: B = None
        self.txt = txt

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

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

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

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

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

m = A("m")
c = B("c")
g = C("g")
n = D("n")
l = E("l")
j = F("j")

m.p = l
m.v = j
m.s = c
c.v = l
c.r = j
c.o = n
c.t = n
g.x = l
g.p = n
g.s = j
n.v = j
n.q = m
l.p = n
j.q = n
j.y = n
j.v = l
j.x = l
j.t = c
assert m.v.y.q.txt == "m"