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

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.x: C = None
        self.v: E = None
        self.txt = txt

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.x: C = None
        self.v: E = None
        self.txt = txt

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

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

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

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

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

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